pub struct KeyFrame {
    pub file_pos: u64,
    pub time_pos: f64,
}

pub struct MetaData {
    pub duration: f64,
    pub width: u32,
    pub height: u32,
    pub video_data_rate: f64,
    pub frame_rate: f64,
    pub video_codec_id: u8,
    pub audio_sample_rate: u8,
    pub audio_sample_size: u8,
    pub audio_stereo: bool,
    pub audio_codec_id: u8,
    //    pub file_size: u64,
    pub timestamp_last: f64,
    pub timestamp_last_key_frame: f64,
    pub audio_delay: f64,
    pub can_seek_to_end: bool,
    pub date_creation: String,
    pub meta_data_creator: String,

    pub key_frames: Vec<KeyFrame>,
    pub samples: [i32; 6],
}

impl MetaData {
    pub const POS_META_DATA_SIZE: u64 = 0x0E;
    pub const POS_DURATION: u64 = 0x35;
    // pub const POS_WIDTH: u64 = 0x45;
    // pub const POS_HEIGHT: u64 = 0x56;
    pub const POS_VIDEO_DATA_RATE: u64 = 0x6E;
    pub const POS_FRAME_RATE: u64 = 0x82;
    pub const POS_VIDEO_CODEC_ID: u64 = 0x99;
    pub const POS_AUDIO_SAMPLE_RATE: u64 = 0xB3;
    pub const POS_AUDIO_SAMPLE_SIZE: u64 = 0xCD;
    pub const POS_AUDIO_STEREO: u64 = 0xDE;
    pub const POS_AUDIO_CODEC_ID: u64 = 0xEE;
    pub const POS_FILE_SIZE: u64 = 0x101;
    pub const POS_TIMESTAMP_LAST: u64 = 0x119;
    pub const POS_TIMESTAMP_LAST_KEY_FRAME: u64 = 0x139;
    // pub const POS_AUDIO_DELAY: u64 = 0x14E;
    pub const POS_CAN_SEEK_TO_END: u64 = 0x165;
    pub const POS_DATE_CREATION: u64 = 0x177;
    pub const POS_META_DATA_CREATOR: u64 = 0x19A;

    pub const META_1: [u8; 410] = [
        0x46, 0x4C, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x6F, 0x6E, 0x4D,
        0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x08, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x64,
        0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x64, 0x61, 0x74, 0x61,
        0x72, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
        0x66, 0x72, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x0C, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x63, 0x6F, 0x64, 0x65, 0x63,
        0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x61, 0x75,
        0x64, 0x69, 0x6F, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x61, 0x75, 0x64, 0x69, 0x6F, 0x73,
        0x61, 0x6D, 0x70, 0x6C, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x06, 0x73, 0x74, 0x65, 0x72, 0x65, 0x6F, 0x01, 0x00, 0x00, 0x0C,
        0x61, 0x75, 0x64, 0x69, 0x6F, 0x63, 0x6F, 0x64, 0x65, 0x63, 0x69, 0x64, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x69, 0x7A,
        0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x6C, 0x61, 0x73,
        0x74, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x6C, 0x61, 0x73, 0x74, 0x6B, 0x65, 0x79, 0x66, 0x72,
        0x61, 0x6D, 0x65, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x61, 0x75, 0x64, 0x69, 0x6F, 0x64, 0x65,
        0x6C, 0x61, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x63,
        0x61, 0x6E, 0x53, 0x65, 0x65, 0x6B, 0x54, 0x6F, 0x45, 0x6E, 0x64, 0x01, 0x00, 0x00, 0x0C,
        0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x64, 0x61, 0x74, 0x65, 0x02, 0x00, 0x11,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x0F, 0x6D, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x63, 0x72, 0x65,
        0x61, 0x74, 0x6F, 0x72, 0x02,
    ];
    pub const META_2: [u8; 28] = [
        0x00, 0x09, 0x6B, 0x65, 0x79, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x03, 0x00, 0x0D, 0x66,
        0x69, 0x6C, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x0A,
    ];
    pub const META_3: [u8; 8] = [0x00, 0x05, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x0A];
    pub const META_4: [u8; 6] = [0x00, 0x00, 0x09, 0x00, 0x00, 0x09];
}
